﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ScrumTable.Common.Collections;
using ScrumTable.Common.Text;

#endregion

namespace ScrumTable.Common.Test.Text
{
    /// <summary>
    /// This is the test class for ValueParser class.
    /// </summary>
    [TestClass]
    public class ValueParserTest
    {
        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------

        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        #endregion

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        /// <summary>
        /// Creates a new ValueParserTest instance.
        /// </summary>
        public ValueParserTest()
        {
        }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        [TestMethod]
        public void TestParse()
        {
            ValueParser parser = new ValueParser();
            ICollection<string> data = parser.Parse(Resources.ValueParseStringOutput);

            Assert.AreEqual(Resources.ValueParseFirstValue, data.First());
            Assert.AreEqual(Resources.ValueParseSecondValue, data.Second());
            Assert.AreEqual(Resources.ValueParseThirdValue, data.Third());
        }

        [TestMethod]
        public void TestToString()
        {
            string newOutputValue = new ValueParser().ToString(
                new[]
                    {
                        Resources.ValueParseFirstValue,
                        Resources.ValueParseSecondValue,
                        Resources.ValueParseThirdValue
                    } );
            Assert.AreEqual(Resources.ValueParseStringOutput, newOutputValue);
        }

        #endregion

        #region Events
        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        #endregion
    }
}
